Component({
    data: {
        selected: 0, // 默认选择的 Tab 的下标
        color: "#797d82", // 默认的文字颜色
        selectedColor: "#ff5f16", // 高亮的文字颜色
        list: [{
                "iconPath": "/assets/icon-films.png",
                "selectedIconPath": "/assets/icon-films-active.png",
                "pagePath": "/pages/films/index",
                "text": "影片"
            },
            {
                "iconPath": "/assets/icon-cinemas.png",
                "selectedIconPath": "/assets/icon-cinemas-active.png",
                "pagePath": "/pages/cinemas/index",
                "text": "影院"
            },
            {
                "iconPath": "/assets/icon-center.png",
                "selectedIconPath": "/assets/icon-center-active.png",
                "pagePath": "/pages/center/index",
                "text": "我的"
            }
        ]
    },
    attached() {},
    methods: {
        switchTab(e) {
            // e - 事件对象
            // e-currentTarget - 绑定事件的元素
            // e-currentTarget.dataset - 获取该元素身上 data-xxx 所设置的属性，比如说
            //      data-a="1"  data-b="2"      => { a: '1', b: '2' }
            const data = e.currentTarget.dataset
            const url = data.path
            // 切换Tab, 路径需要以 /开头
            wx.switchTab({
                url: url
            })
            // this.setData({
            //     selected: data.index
            // })
        }
    }
})